<template>
  <el-menu
    default-active="2"
    class="el-menu-vertical-demo"
    @open="handleOpen"
    @close="handleClose"
    :router="true"
  >
    <el-menu-item index="4">
      <i class="el-icon-setting"></i>
      <template #title>首页</template>
    </el-menu-item>
    <el-submenu index="1">
      <template #title>
        <i class="el-icon-location"></i>
        <span>系统管理</span>
      </template>
      <el-menu-item index="/xtuser">
        <i class="el-icon-menu"></i>
        <template #title>用户管理</template>
      </el-menu-item>
      <el-submenu index="1-4">
        <template #title>自动生成代码</template>
        <el-menu-item index="/code">首次生成</el-menu-item>
        <el-menu-item index="1-4-1">二次修改</el-menu-item>
      </el-submenu>
    </el-submenu>
    <el-menu-item index="/modifyCode">
      <i class="el-icon-menu"></i>
      <template #title>代码</template>
    </el-menu-item>
    <el-menu-item index="/bar">
      <i class="el-icon-document"></i>
      <template #title>EchartsBar</template>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
